package pojo.administrador;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "tbs_usuario_regra")
@NamedQueries({
    @NamedQuery(name = "Regra.listAll", query = "SELECT r FROM Regra r"),
    @NamedQuery(name = "Regra.getByLogin", query = "SELECT r FROM Regra r WHERE r.usuario.login = :login")
})
public class Regra implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "REG_ID")
    private long id;
    @Column(name = "REG_NOME", length = 45, nullable = false)
    private String nome;
    @OneToOne
    @JoinColumn(name = "USU_LOGIN", referencedColumnName = "USU_LOGIN", insertable = true, updatable = false)
    private Usuario usuario;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }
}